package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.model.product.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMappper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author LEO
 * @Date 2021年12月10日 22:03
 */
// public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T>
    //IService 实现类（ 泛型：M 是 mapper 对象，T 是实体 ， PK 是主键泛型 ）
@Service
public class BaseTrademarkServiceImpl extends ServiceImpl<BaseTrademarkMappper,BaseTrademark> implements BaseTrademarkService {

    @Autowired
    private BaseTrademarkMappper baseTrademarkMappper;


    /**
     * 分页查询所有品牌
     * @param baseTrademarkPage
     * @return
     */
    @Override
    public IPage getBaseTrademarkList(Page<BaseTrademark> baseTrademarkPage) {
        QueryWrapper<BaseTrademark> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        return baseTrademarkMappper.selectPage(baseTrademarkPage,queryWrapper);
    }

//    //保存品牌
//    @Override
//    public void save(BaseTrademark baseTrademark) {
//
//        //自己编写的insert
////        baseTrademarkMappper.insert(baseTrademark);
//    }
}
